---
title: bud.path
description: Returns an absolute path to a directory or file.
tags:
  - helpers
  - filesystem
---

You can use **bud.path** to reference a file or directory's absolute path.

## Usage

```ts
bud.path('./src/scripts/components')
```

You may also choose to deliniate directories with an `Array` of path segments, rather than a `String`:

```ts
bud.path('./src', 'scripts', 'components')
```

## Special path handles

The following is a table containing `string` values which fulfill a special role in the context of the **bud.path** function:

| handle       | description                      | default          |
| ------------ | -------------------------------- | ---------------- |
| **@src**     | source directory                 | `./src`          |
| **@dist**    | destination directory            | `./dist`         |
| **@storage** | cache/artifact storage directory | `./.budfiles`    |
| **@modules** | modules directory                | `./node_modules` |

:::note

The `@storage` path is used to store cache and artifact files. It should not be set with `bud.setPath`. There is a lot of logic
that depends on this path being set and much of it executes before any user configuration files are loaded.

If you want to customize the storage path, you should use the **--storage** flag instead.

:::

When one of these handles is used at **the beginning of a string path** (or the first segment in a multi-segment path), the path will be
prefixed with the corresponding directory.

For example, to reference the `./src` directory:

```ts
bud.path('@src/scripts/components')
```

You can create your own handles for use in the **bud.path** function. But, the handles in this table are standard.
Other parts of bud.js or its ecosystem may use these handles to reference project directories. So, while they may be freely modified as needed, they should not be removed or repurposed.

## System path handles

These handles should be considered read-only.

| handle         | description                                               |
| -------------- | --------------------------------------------------------- |
| **@os-cache**  | absolute path to project folder in os cache directory     |
| **@os-temp**   | absolute path to project folder in os tempfiles directory |
| **@os-data**   | absolute path to project folder in os data directory      |
| **@os-log**    | absolute path to project folder in os log directory       |
| **@os-config** | absolute path to project folder in os config directory    |
